﻿#pragma once
#include "AsGraphicsObject.h"
#include <QImage>

namespace AsGraphicsNamespace {

	AS_MEMBER_CLASS_DECLARATION(AsGraphicsVideoDisplayer);

	class AS_GRAPHICS_API AsGraphicsVideoDisplayer : public AsGraphicsObject, AsBinder<AsGraphicsVideoDisplayer> {
	public:
		explicit AsGraphicsVideoDisplayer(QObject* parent = nullptr);
		explicit AsGraphicsVideoDisplayer(AsGraphics* graphics, QObject* parent = nullptr);
		~AsGraphicsVideoDisplayer();
		enum Params {
			AutoDelay = -1,
			DefaultFps = 30,
			DefaultBufferSize = 9,
			DefaultMinDelay = 10
		};

	private:
		AS_MEMBER_CLASS(AsGraphicsVideoDisplayer)* mp;

	public:
		void create(AsGraphics* graphics, QObject* parent = nullptr);
		void destroy();

	public:
		void addFrame(QImage image, int delay = AutoDelay);
		void setMaxFps(double rate = DefaultFps);
		void setMaxBuffers(int bufferSize = DefaultBufferSize);
		void setMinDelay(int msec = DefaultMinDelay);

	public:
		void setEnable_showStates(bool isEnable = true);

	};

	typedef AsGraphicsVideoDisplayer VideoDisplayer;

};
